#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N=2e4+5;

int n,m,len,rt,cnt;
vector<int> adj[N];
int dfn[N],low[N];
set<int> st;

void dfs(int u){
	dfn[u] = low[u] = ++len;
	int son = 0;
	for(int v:adj[u]){
		if(dfn[v] == 0){
			son++;
			dfs(v);
			low[u] = min(low[u],low[v]);
			if(low[v] >= dfn[u] && u != rt){
				// cout<<v<<' '<<u<<' '<<low[v]<<' '<<low[u]<<'\n';
				st.insert(u);
			}
		}
		else low[u] = min(low[u],dfn[v]);
	}
	if(son >= 2 && u == rt)st.insert(u);
}

void solve(){
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	for(int i=1; i<=n; i++)if(!dfn[i])rt = i,dfs(i);
	rt=1;
	dfs(1);
	cout<<st.size()<<'\n';
	for(int x:st){
		cout<<x<<' ';
	}
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
